package test.struts.forms;
   
   import javax.servlet.http.HttpServletRequest;
   import org.apache.struts.action.*;
   
   public class LoginForm extends ActionForm
   {
      private String usuario = "";
      private String clave = "";
  
      public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
      {
          ActionErrors errores = new ActionErrors();
          
          if( usuario.trim().length() <= 0 )
          {
              errores.add("usuario", new ActionMessage("login.usr.noCompleta"));
          }
          
          if( clave.trim().length() <= 0 )
          {
              errores.add("clave" , new ActionMessage("login.pwd.noCompleta"));
          }
          
          return errores;
      }
  
      public void reset(ActionMapping mapping , HttpServletRequest request)
      {
          clave="";
      }
  
      public String getUsuario()
      {
          return usuario;
      }
      
      public void setUsuario(String usuario)
      {
          this.usuario = usuario;
      }
      
      public String getClave()
      {
          return clave;
      }
      
      public void setClave(String clave)
      {
          this.clave = clave;
      }
      
  }
  